package com.turing.post.datatranferpmbs.impl;

import java.util.Date;
import java.util.List;

import javax.ejb.Local;
import javax.ejb.Remote;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;

import com.turing.post.datatranferpmbs.util.PMBSMchAddTradDetail;
import com.turing.post.datatranferpmbs.util.PMBSMchAddTradDetailDao;

@Stateless(mappedName = "datatranferpmbs.impl.PMBSMchAddTradDetailDaoImpl")
@Remote
@Local
public class PMBSMchAddTradDetailDaoImpl implements PMBSMchAddTradDetailDao {

	/**
	 * 实体管理器
	 */
	@PersistenceContext
	protected EntityManager _em;

	@SuppressWarnings("unchecked")
	@Override
	public List<PMBSMchAddTradDetail> getAllMchAddTradDetailByTranSeqNo(
			String merchantNo, Date tranDate, String tranSeqNo) {
		String sql = "select * from MchAddTradDetail where merchantNo = ?1 and tranDate = ?2 and tranSeqNo = ?3";
		Query query = _em.createNativeQuery(sql, PMBSMchAddTradDetail.class);
		query.setParameter(1, merchantNo);
		query.setParameter(2, tranDate);
		query.setParameter(3, tranSeqNo);
		List<PMBSMchAddTradDetail> matdlist = query.getResultList();
		return matdlist;
	}
}
